#if  (FEATURE_MODE == 0)
/**
 @file ctc_usw_pon_cli.c

 @author  Copyright (C) 2023 Suzhou Centec Communications Co., Ltd.  All rights reserved.

 @date 2023-06-20

 @version v1.0

 This file define pon sample CLI functions

*/

#include "sal.h"
#include "ctc_api.h"
#include "ctc_cli.h"
#include "ctcs_api.h"
#include "ctc_error.h"
#include "ctc_debug.h"
#include "ctc_cli_common.h"
#include "ctc_usw_pon_cli.h"

extern int32
sys_usw_pon_get_gem_port_hw_index(uint8 lchip, ctc_pon_gem_port_t* p_gem_port);


CTC_CLI(ctc_cli_usw_pon_get_gem_port,
        ctc_cli_usw_pon_get_gem_port_cmd,
        "show pon gem-port port  GPORT tunnel-vlan TUNNEL_VLAN (flooding|) (detail |)",
        "Show",
        "Pon",
        "Gem-port",
        "Port",
        CTC_CLI_GPHYPORT_ID_DESC,
        "Tunnel-vlan",
        "TUNNEL_VLAN",
        "Flodding",
        "Detail")
{
    int32 ret = 0;
    ctc_pon_gem_port_t cfg;
    uint8 index = 0;

    sal_memset(&cfg, 0, sizeof(cfg));
    CTC_CLI_GET_UINT32_RANGE("gport", cfg.gport, argv[0], 0, CTC_MAX_UINT32_VALUE);
    CTC_CLI_GET_UINT32_RANGE("tunnel-vlan", cfg.tunnel_value, argv[1], 0, CTC_MAX_UINT32_VALUE);
	
    index = CTC_CLI_GET_ARGC_INDEX_ENHANCE("flooding");
    if (index != 0xFF)
    {
        CTC_SET_FLAG(cfg.flag,CTC_PON_GEM_PORT_FLAG_FLOODING);
    }

    if(g_ctcs_api_en)
    {
        ret = ctcs_pon_get_gem_port(g_api_ldev,&cfg);
    }
    else
    {
        ret = ctc_pon_get_gem_port(&cfg);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% %s\n", ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    else
    {
         ctc_cli_out("---------------------------------------------------------------\n");
         ctc_cli_out("%-15s0x%-8x\n","gport:" , cfg.gport);
         ctc_cli_out("%-15s%-10u\n","tunnel_value:" , cfg.tunnel_value);
         ctc_cli_out("%-15s%-10u\n","logic_port:" , cfg.logic_port);
         ctc_cli_out("%-15s%-10u\n","pass_through_en:", cfg.pass_through_en);
         ctc_cli_out("%-15s%-10u\n","limit_action:" , cfg.limit_action);
         ctc_cli_out("%-15s%-10u\n","igs_policer_id:" , cfg.igs_policer_id);
         ctc_cli_out("%-15s%-10u\n","egs_service_id:" , cfg.egs_service_id);
        ctc_cli_out("---------------------------------------------------------------\n");
    }   
    index = CTC_CLI_GET_ARGC_INDEX_ENHANCE("detail");
    if (index != 0xFF)
    {
        ret = sys_usw_pon_get_gem_port_hw_index(g_api_lchip, &cfg);
        if (ret < 0)
        {
            ctc_cli_out("%% %s\n", ctc_get_error_desc(ret));
            return CLI_ERROR;
        }
    }
    return CLI_SUCCESS;

}


int32
ctc_usw_pon_cli_init(void)
{    
    install_element(CTC_SDK_MODE, &ctc_cli_usw_pon_get_gem_port_cmd);
     
    return CLI_SUCCESS;
}

int32
ctc_usw_pon_cli_deinit(void)
{    
    uninstall_element(CTC_SDK_MODE, &ctc_cli_usw_pon_get_gem_port_cmd);
     
    return CLI_SUCCESS;
}
#endif
